//自定义验证规则
const joi = require('joi')

//定义用户名和密码的验证规则
const currentPage = joi.number().integer().min(1).required()
const pageNum = joi.number().integer().min(1).required()
const keyword = joi.string().allow('')
const goods_id = joi.number().integer().required()
const cat_id = joi.number().integer().required()

//这样的导出方式是该中间件固定写法
module.exports = {
    getGoodList_check: {
        query: {
            currentPage,
            pageNum,
            keyword
        }
    },
    delGood_check: {
        body: {
            goods_id
        }
    },
    getGoodAttribute_check: {
        query: {
            cat_id
        }
    }
}